﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Enterprise.Infrastructure;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.Model.User;
using Enterprise.DataFactory;
namespace Enterprise.Data.User
{
    /// <summary>
    /// 用户配置
    /// </summary>
    public class UserConfigData
    {
        /// <summary>
        ///  用户配置记录数据列表
        /// </summary>
        /// <returns></returns>
        public List<UserConfigEntity> UserConfigList()
        {
            List<UserConfigEntity> list = new List<UserConfigEntity>();
            string cmd = "Select * from SYS_WORKFLOWPROCESS";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                UserConfigEntity entity = new UserConfigEntity();
                if (!Convert.IsDBNull(dr["CID"])) entity.CID = Convert.ToInt32(dr["CID"]);
                if (!Convert.IsDBNull(dr["WFTYPEID"])) entity.WFTYPEID = Convert.ToInt32(dr["WFTYPEID"]);
                if (!Convert.IsDBNull(dr["CUSERID"])) entity.CUSERID = Convert.ToInt32(dr["CUSERID"]);
                if (!Convert.IsDBNull(dr["CTOUSERID"])) entity.CTOUSERID = Convert.ToInt32(dr["CTOUSERID"]);
                if (!Convert.IsDBNull(dr["CSTIME"])) entity.CSTIME = Convert.ToDateTime(dr["CSTIME"]);
                if (!Convert.IsDBNull(dr["CETIME"])) entity.CETIME = Convert.ToDateTime(dr["CETIME"]);
                if (!Convert.IsDBNull(dr["CSTATE"])) entity.CSTATE = Convert.ToInt32(dr["CSTATE"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void UserConfigExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }
    }
}
